import { createRouter, createWebHistory } from 'vue-router'

export default createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/home',
      component: () => import('@/pages/home/index.vue'),
      meta: {
        title: '首页'
      }
    },
    {
      path: '/hospital',
      component: () => import('@/pages/hospital/index.vue'),
      children: [
        {
          path: 'register',
          component: () => import('@/pages/hospital/components/register.vue'),
          meta: {
            title: '预约挂号'
          }
        },
        {
          path: 'notice',
          component: () => import('@/pages/hospital/components/notice.vue'),
          meta: {
            title: '预约须知'
          }
        },
        {
          path: 'close',
          component: () => import('@/pages/hospital/components/close.vue'),
          meta: {
            title: '停诊信息'
          }
        },
        {
          path: 'detail',
          component: () => import('@/pages/hospital/components/detail.vue'),
          meta: {
            title: '医院详情'
          }
        },
        {
          path: 'search',
          component: () => import('@/pages/hospital/components/search.vue'),
          meta: {
            title: '查询/取消'
          }
        },
        {
          path: 'department',
          component: () => import('@/pages/hospital/components/department.vue'),
          meta: {
            title: '选择号源'
          }
        },
        {
          path: 'registerChose',
          component: () => import('@/pages/hospital/components/registerChose.vue'),
          meta: {
            title: '确定挂号信息'
          }
        }
      ]
    },
    {
      path: '/',
      redirect: '/home',
      meta: {
        title: '首页'
      }
    },
    {
      path: '/user',
      component: () => import('@/pages/user/index.vue'),
      children: [
        {
          path: 'certification',
          component: () => import('@/pages/user/components/certification.vue'),
          meta: {
            title: '实名认证'
          }
        },
        {
          path: 'order',
          component: () => import('@/pages/user/components/order/index.vue'),
          meta: {
            title: '挂号订单'
          }
        },
        {
          path: 'patient',
          component: () => import('@/pages/user/components/patient.vue'),
          meta: {
            title: '就诊人管理'
          }
        },
        {
          path: 'profile',
          component: () => import('@/pages/user/components/profile.vue'),
          meta: {
            title: '账号信息'
          }
        },
        {
          path: 'feedback',
          component: () => import('@/pages/user/components/feedback.vue'),
          meta: {
            title: '信息反馈'
          }
        }
      ]
    }
  ],
  scrollBehavior() {
    return {
      left: 0,
      top: 0
    }
  }
})